package com.example.husbandry_online.Util;

import android.app.Activity;
import android.content.Context;
import android.util.Log;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.example.husbandry_online.R;
import com.example.husbandry_online.view.LoginAndRegisterActivity;

public class FragmentChange {
    public static void changeRegisterFrag(Fragment newFragment){
        //得到管理类
        FragmentManager fragmentManager = new LoginAndRegisterActivity().getSupportFragmentManager();
        //开始事务
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        //事务创建
        fragmentTransaction.replace(R.id.LoginAndRegisterFrag,newFragment);

        fragmentTransaction.addToBackStack(null);
        //事务提交
        fragmentTransaction.commit();
    }
}
